import type { Rule } from "ant-design-vue/es/form";

//邮箱格式校验
export const emailvalidate = async (_rule: Rule, value: string) => {
  let regNeg =
    /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
  if (value == "" || value == undefined) return Promise.reject("邮箱不能为空");
  if (!regNeg.test(value)) {
    return Promise.reject("邮箱格式错误");
  }
  return Promise.resolve();
};
